'''
    1 默认等待时间
    2 强制等待时间
    3 获取input的value
    3 获取元素属性值


'''

from playwright.sync_api import sync_playwright



with sync_playwright() as p:
    browser = p.chromium.launch(headless=False)
    page = browser.new_page()


    page.goto('http://www.baidu.com')
    page.locator('#kw').focus()
    page.wait_for_timeout(2000)


    page.keyboard.down('A')
    page.wait_for_timeout(2000)
    page.keyboard.up('A')
    page.wait_for_timeout(2000)
    page.keyboard.down('B')
    page.keyboard.up('B')


    page.keyboard.press('d')

    page.keyboard.type('dddd顶顶顶搜索')
    page.keyboard.insert_text('dddd顶顶顶搜索2')
    page.wait_for_timeout(5000)
